package com.hdaccp.goodsprovider.service.Impl;

import com.hdaccp.goodsprovider.service.GoodsTypeService;
import org.main.bean.POJO.PGoodsType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.persistence.EntityManager;
import javax.persistence.Query;
import java.util.List;
@Service
public class GoodsTypeServiceImpl implements GoodsTypeService {
    @Autowired
    private EntityManager entityManager;
    @Override
    public List<PGoodsType> queryPage(int currentage, int pageSize) {

        //用jpa1接收sql语句
        String jpa1="select t from Goodstype t";
        Query query=entityManager.createQuery(jpa1);
        query.setFirstResult((currentage-1)*pageSize);
        query.setMaxResults(pageSize);

        return query.getResultList();
    }
}
